var divObj ;
//文档加载完毕后触发
window.onload = function (){
    divObj = document.getElementById("imgDiv");
    //得到指定元素中，所有标签名为img的子元素集合
    var imgArray = divObj.getElementsByTagName("img");
    for(var i=0;i<imgArray.length;i++){
        //给每个图片对象，添加点击事件
        imgArray[i].onclick = function (){
            selectImg(this);
        }
    }
}

function showDiv(){
    divObj.style.display = "block";
}

function selectImg(clickImg){
    var imgObj = document.getElementById("faceImg");
    imgObj.src = clickImg.src;
    divObj.style.display = "none";
}